package com.koalac.ironman.net.pojo.response;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

public class GalleryItem extends BaseResponse{
	
	private String userId;
	private String id;
	private String authorName;
	
	private String headImgUrl;
	private String message;
	private int goodNumber;
	
	private String dateline;
	/**
	 * 1 点赞过 0 没点赞过
	 */
	public static final int LIKED = 1;
	public static final int UNLIKE = 0;
	private int good_flag;
	public int getGood_flag() {
	    return good_flag;
	}

	public void setGood_flag(int good_flag) {
	    this.good_flag = good_flag;
	}

	private List<GalleryPicture> galleryPictureList = new ArrayList<GalleryPicture>();
	
	@Override
	public void init(JSONObject source) {
		if (source != null) {
			userId = source.optString("user_id");
			id = source.optString("id");
			authorName = source.optString("author_name");
			
			headImgUrl = source.optString("head_img_url");
			message = source.optString("message");
			goodNumber = source.optInt("good_number");
			
			dateline = source.optString("dateline");
			good_flag = source.optInt("good_flag");
			JSONArray jsonArray = source.optJSONArray("Galleryspicture");
			if (jsonArray != null && jsonArray.length() != 0) {
				for (int i = 0; i < jsonArray.length(); i++) {
					JSONObject jsonObject = jsonArray.optJSONObject(i);
					GalleryPicture galleryPicture = new GalleryPicture();
					galleryPicture.init(jsonObject);
					galleryPictureList.add(galleryPicture);
				}
			}
		}
	}
	
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getAuthorName() {
		return authorName;
	}

	public void setAuthorName(String authorName) {
		this.authorName = authorName;
	}

	public String getHeadImgUrl() {
		return headImgUrl;
	}

	public void setHeadImgUrl(String headImgUrl) {
		this.headImgUrl = headImgUrl;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public int getGoodNumber() {
		return goodNumber;
	}

	public void setGoodNumber(int goodNumber) {
		this.goodNumber = goodNumber;
	}

	public String getDateline() {
		return dateline;
	}

	public void setDateline(String dateline) {
		this.dateline = dateline;
	}

	public List<GalleryPicture> getGalleryPictureList() {
		return galleryPictureList;
	}

	public void setGalleryPictureList(List<GalleryPicture> galleryPictureList) {
		this.galleryPictureList = galleryPictureList;
	}

}
